<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Test01</title>
</head>
<body>
<script type="text/javascript">
    var regex01 = /xyz/i;
    var regex02 = new RegExp(/xyz/i);
    var regex03 = new RegExp("xyz", "i");

    var regex04 = new RegExp(/xyz/, "i");

    var str01 = "\uD842\uDFB7";
    var str02 = "\uD842";

    console.log(/^\uD842/u.test(str01));

    var str03 = "aaa-aaa-aaa";
    var regex05 = /a{3}/y;

    console.log(regex05.exec(str03));
    console.log(regex05.exec(str03));
    console.log(regex05.exec(str03));
    console.log(regex05.exec(str03));

    var str03 = "foo\nbar";
    var regex06 = /foo.bar/gs;

    console.log(regex06.test(str03));
</script>
</body>
</html>